
const state = {
	token: uni.getStorageSync('token') || false,
	userInfo: {},
	uid:  1,
};

const mutations = {
	
	LOGIN(state, opt) {
		state.token = opt.token;
		console.log("opt is:" ,opt);
		uni.setStorageSync("token",opt.token);
		uni.setStorageSync("expires_time",opt.time);
	},
	SETUID(state,val){
		state.uid = val;
	},
	UPDATE_LOGIN(state, token) {
		state.token = token;
	},
	LOGOUT(state) {
		state.token = undefined;
		state.uid = undefined
	}
};

const actions = {
	
};

export default {
	state,
	mutations,
	actions
};
